<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <div id="app">


  </div>
  <!-- 引入React依赖 -->
  <script src="../React/react.development.js"></script>
  <script src="../React/react-dom.development.js"></script>
  <script src="../React/babel.min.js"></script>

  <!-- 编写React代码 -->
  <script type="text/babel">
    class App extends React.Component {
      constructor() {
        super()
        //定义变量
        this.state = {
          names: ["aaa", "bbb", "ccc", "ddd", "eee"],
          numbers: [110, 123, 50, 30, 80, 32, 55, 10, 8, 33],
        }
      }
      render() {
        return (
          <div>
            <h2>名字列表</h2>
            {this.state.names.map(item => {
              return <li>{item}</li>
            })}

            <h2>数字列表（过滤）</h2>
            {this.state.numbers.filter((item) => item >= 50).map((item) => <li>{item}</li>)}

            <h2>数字列表（截取）</h2>
            {this.state.numbers.slice(0, 4).map((item) => <li>{item}</li>)}

          </div>
        )
      }
    }
  </script>

  <script type="text/babel">
    ReactDOM.render(<App />, document.getElementById("app"))
  </script>

</body>

</html>